package com.example.materialviewpagerdemo;

import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.example.materialviewpagerdemo.util.Sendcommand;

import java.util.List;

import cn.jzvd.Jzvd;
import cn.jzvd.JzvdStd;

public class CameraAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
    List<Object> contents;
    JzvdStd jzvdStd;

    public CameraAdapter(Context context, List<Object> contents) {
        this.contents = contents;
    }

    @Override
    public int getItemCount() {
        return contents.size();
    }

    @Override
    public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        View view = null;
        view = LayoutInflater.from(parent.getContext())
                .inflate(R.layout.content_cardview, parent, false);
        jzvdStd = view.findViewById(R.id.jzText);
        JzvdStd.SAVE_PROGRESS = false;

//        jzvdStd.thumbImageView.setImageDrawable(getDrawable(R.drawable.red));
        return new RecyclerView.ViewHolder(view) {
        };
    }


    @Override
    public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
        switch (position) {
            case 0:
                jzvdStd.setUp("http://cmgw-hz.lechange.com:8888/LCO/4J0059DAAJ1B8AA/0/0/20191210T071002/dev_4J0059DAAJ1B8AA_20191210T071002.m3u8"
                        , "室内直播1", Jzvd.SCREEN_WINDOW_NORMAL);
                jzvdStd.thumbImageView.setImageResource(R.drawable.head5);
                break;
            case 1:
                jzvdStd.setUp("http://cmgw-hz.lechange.com:8888/LCO/4J0059DAAJ45AAD/0/0/20191210T071033/dev_4J0059DAAJ45AAD_20191210T071033.m3u8"
                        , "室内直播2", Jzvd.SCREEN_WINDOW_NORMAL);
                jzvdStd.thumbImageView.setImageResource(R.drawable.head5);
                break;
//            case 0:
//                jzvdStd.setUp("http://alhlsgw.lechange.com:9001/LCO/4J0059DAAJ88BD7/0/0/20191104202215/dev_20191104202215_45cfbge9q9qr8gdi.m3u8"
//                        , "金乡", Jzvd.SCREEN_WINDOW_NORMAL);
//                jzvdStd.thumbImageView.setImageResource(R.drawable.head3);
//                break;
//            case 1:
//                jzvdStd.setUp("http://alhlsgw.lechange.com:9001/LCO/4J0059DAAJC639F/0/0/20191104202344/dev_20191104202344_ih44r3k4res8t3k1.m3u8"
//                        , "杞县", Jzvd.SCREEN_WINDOW_NORMAL);
//                jzvdStd.thumbImageView.setImageResource(R.drawable.head3);
//                break;
//            case 2:
//                jzvdStd.setUp("http://aliszhlsgateway.lechange.cn:9001/LCO/4J0059DAAJ64EDE/0/0/20191111155915/dev_20191111155915_437t9bcd2plqqg9b.m3u8"
//                        , "邳州", Jzvd.SCREEN_WINDOW_NORMAL);
//                jzvdStd.thumbImageView.setImageResource(R.drawable.head3);
//                break;
//            case 3:
//                jzvdStd.setUp("http://aliszhlsgateway.lechange.cn:9001/LCO/4J0059DAAJE5A08/0/0/20191112083535/dev_20191112083535_6k8rkkec6s6k702i.m3u8"
//                        , "兰陵", Jzvd.SCREEN_WINDOW_NORMAL);
//                jzvdStd.thumbImageView.setImageResource(R.drawable.head3);
//                break;
       }
    }
}
